package ch6;

import java.util.Scanner;

public class GetArrayMax {

	public static void main(String[] args) {
		// 求数组中的最大值
		int[] a1 = new int[6];
		Scanner in = new Scanner(System.in);
		System.out.println("输入" + a1.length + "个整数：");
		for (int i = 0; i < a1.length; i++) {
			a1[i] = in.nextInt();
		}
		int max = a1[0];
		for (int i = 1; i < a1.length; i++) {
			if (max < a1[i]) {
				max = a1[i];
			}
			// max = max < a1[i] ? a1[i] : max;
		}
		System.out.println("这个数组中最大的是：" + max);
	}

}
